package org.yanyi.jvm;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MainTest {
    private static int count;
    private static List<Object> list = new ArrayList<>();

    public static void main(String[] args) {
//        mainTest();
//        mainOom();

        try {
            int i = 1 / 0;
        }catch (Exception e) {
//            e.printStackTrace();
        }

        System.out.println("哈哈");
    }



    public static void mainTest() {
        try {
            test();
        }catch (Throwable t) {
            System.out.println(count);
            throw t;
        }
    }

    public static void test() {
        long u01,un02,un03,un04,un05,un06,un07,un08,un09,un10;
        count++;
        test();
    }

    public static void mainOom() {
        try {
            oom();
        }catch (Throwable t) {
            System.out.println(count);
            t.printStackTrace();
        }
    }

    public static void oom() {
        for (; ;) {
            list.add(new Object());
            count++;
        }
    }
}
